<?php
/**
 * author:歪妻
 * Date: 2020/11/11 0011
 */

/**
 * @var $pdo PDO
 * @var $postId integer
 */
?>

<form action="view-post.php?action=delete-comment&amp;post_id=<?php echo $postId?>&amp;" method="post" class="comment-list">

    <h3><?php echo $commentCount ?> 评论</h3>
    <?php foreach (getCommentsForPost($pdo,$postId) as $comment): ?>
        <div class="comment">
            <div class="comment-meta">
                评论 来自
                <?php echo htmlEscape($comment['name']) ?>
                at
                <?php echo convertSqlDate($comment['created_at']) ?></a>
                <?php if (isLoggedIn()):?>
                    <input type="submit" name="delete-comment[<?php echo $comment['id']?>]" value="Delete">
                <?php endif ?>
            </div>
            <div class="comment-body">
                <?php echo htmlEscape($comment['text']) ?>
                <a href="<?php echo htmlEscape($comment['website'])?>">个人网站</a>
            </div>
        </div>
    <?php endforeach ?>
</form>